<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			h1, h2, h3, h4, h5, h6, p, span {
				font-family: Open Sans, Seravek, Segoe UI, Verdana, PingFang SC, Hiragino Sans GB, Lantinghei SC, Microsoft Yahei, Consoles, WenQuanYi Micro Hei, sans;
			}
			html, body {
				transition: all 2s;
				background-color: #fff;
				height: 100%;
				margin:0;
			}
			.heart{
				position: relative;
				width: 100px;
				height: 90px;
				opacity: 0;
				transition: all 2s;
			}
			.heart:before,
			.heart:after{
				position: absolute;
				content: "";left: 
				50px;
				top: 0;
				content: "";
				width: 50px;
				height: 80px;
				background: #fc2e5a;
				border-radius: 50px 50px 0 0;
				transform-origin: 0 100%;
				transform: rotate(-45deg);
			}
			.heart:after{
				left: 0;
				transform-origin :100% 100%;
				transform: rotate(45deg);
			}
			#app {
				transition: all 2s;
			}
			#chatbox {
				width: 400px;
				position: relative;
			}
			#chatbox:after {
				position: absolute;
				padding: 5px;
				top: 0;
				left: 0;
				background-color: #66ccff;
				color: #fff;
				text-align: center;
				content: "MBot V1.0.1";
				width: 98%;
				overflow: hidden;
			}
			#mainpan {
				height: 350px;
				background-color: #fcfcfc;
				overflow: scroll;
				padding: 10px;
				width: 96%;
			}
			#mainsay {
				height: 150px;
				width: 90%;
			}
			button {
				background-color: #66ccff;
				outline: none;
				border: none;
				border-radius: 10px;
				padding: 10px 20px;
				color: #fff;
				transition: all 0.5s;
			}
			#mainbutton {
				position: absolute;
				bottom: 20px;
				right: 10px;
				z-index: 52014;
			}
			input, textarea {
				padding: 10px 20px;
				outline: none;
				border: none;
				border-bottom: 1px solid #000;
				translate: all 0.3s;
			}
			input:hover, input:focus, textarea:hover, textarea:focus {
				animation:inputBo 5s infinite alternate;
			}
			@keyframes inputBo
			{
				0%   {border-bottom: 1px solid red;}
				20%  {border-bottom: 1px solid yellow;}
				40%  {border-bottom: 1px solid blue;}
				60% {border-bottom: 1px solid green;}
				80% {border-bottom: 1px solid purple;}
				0%   {border-bottom: 1px solid red;}
			}
			@media (max-width: 600px) {
				#chatbox {
					width:100%;
				}
				#qwq {
					display:none;
				}
			}
 
			button:hover {
				background-color: #77ddff;
			}
			.titlesay {
				color: #aaa;
			}
			.systembox {
				text-align:center;
			}
			.systemsay {
				background-color: #aaa;
				color: #fff;
				padding: 2px 4px;
				border-radius:5px;
			}
			.isay {
				color: red;
			}
			.ysay {
				color: blue;
			}
			::-webkit-scrollbar {
				width: 5px;
			}
			::-webkit-scrollbar-thumb {
				border-radius: 10px;
				-webkit-box-shadow: inset 0 0 5px #bebebe;
				background: #bebebe;
				transition: all 0.5s;
			}
			::-webkit-scrollbar-thumb:hover {
				border-radius: 10px;
				-webkit-box-shadow: inset 0 0 5px #aaaaaa;
				background: #aaaaaa;
			}
			::-webkit-scrollbar-track {
				-webkit-box-shadow: inset 0 0 5px #e0e0e0;
				border-radius: 0;
				background: #e0e0e0;
				opacity:1;
			}
		</style>
	</head>

	<body>
		<div id="app">
		<div id="chatbox" style="float:left;z-index:2000"><br>
			<div id="mainpan">
				<span id="mainchat"></span>
			</div>
			<textarea id="mainsay"></textarea>
			<button onclick="shiw()" id="mainbutton">发送</button>
		</div>
		<div id="qwq" style="float:left;width: 400px;border:1px solid #000;margin-left:30px;padding:10px;">
		<p style="z-index:2000">
			<span style='font-size: 26px' id="qassa">版本(20:14 2020/2/17)</span>
			<hr/>
			更新说明：<ol><li>词库更新<li>添加彩蛋<li>修复了bug<li>更改了ui<li>支持用<code>calc: js表达式</code>可以用eval运行js表达式</ol>
			注: calc规则请看<a href="https://www.w3school.com.cn/js/jsref_eval.asp">Js eval</a><br>
			GitHub地址：<a href="https://github.com/mstcomp/mstcomp.github.io/blob/master/bot.html">mstcomp/mstcomp.github.io/bot.html</a>
			<hr/>
			操控机器人：<input type=text id="robotInput" required><button onclick="teacherSay(robotInput.value);robotInput.value='';">发送</button><br>
			操控系统：<input type=text id="systemInput" required><button onclick="systemSay(systemInput.value);robotInput.value='';">发送</button>
			<button id="btn1" onclick="systemSay(BotName+'被你禁言');robotNotSay=true;robotInput.disabled='disabled';btn1.style.display='none';btn2.style.display='';">禁言机器人</button>
			<button id="btn2" onclick="systemSay(BotName+'被你解除禁言');robotNotSay=false;robotInput.disabled='';btn2.style.display='none';btn1.style.display='';" style="display:none">解禁机器人</button>
			<button onclick="goFinish()">结束聊天</button>
			<hr/>
			没反应说明系统卡住了，刷新就好了<br>
			不要频繁的召唤彩蛋，不然会超级卡的
		</p>
		</div>
		<div style="clear: both"></div>
		</div>
		<div id="heartBoard" style="display:none;position: absolute;top:0;width: 100%;height:100%;transition: all 3s">
		</div>
			<p style="position:absolute; top:-130%;color:white;z-index:20;font-size:60px;content:'233';left:20%;transition: all 3s;" id="gggyyy">Yemaster Loves SSH<br><button style="background-color:#FF3399;float:left" onclick="alert('爱你哟');">支持 / Support</button><button style="background-color:#FF3399;float:right" onclick="app.style.opacity='1';app.style.display='';app.style.zIndex='200';gggyyy.style.display='none';">返回对话 / Back to chat</button><div style="clear:both"></div></p>
		<script>
			var hahahehehe;
			var asdbfdscisxhawdiuahwimiwm;
			var robotNotSay=false;
			var BotName = "Yemaster";
			var cow = 0;
			document.title = BotName+"聊天";
			var ableToOpen = 0;
			var useTime = 0;
			var GMotherName = "xdc";
			function getTime() {
				var obj = new Date();
				return obj.getHours()+":"+obj.getMinutes()+":"+obj.getSeconds();
			}
			function fd(a, b) {
				c=b.split("");
				for (var i=0;i <c.length;i++) {
					if (a.indexOf(c[i]) == -1)
					return false;
				}
				return true;
			}
			function fd2(a, b) {
				if (a.indexOf(b) == -1)
					return false;
				return true;
			}
			function Rand() {
				return Math.floor(Math.random()*10000);
			}
			function goFinish() {
				mainsay.disabled="disabled";
				mainsay.style.display="none";
				mainbutton.style.display="none";
				mainchat.style.height="500px";
				systemSay("本次聊天到此结束");
				teacherSay("<span id=phona>您可以留下您的邮箱:<input type=text name=phone><input type=submit value=OK onclick='document.getElementById(\"phona\").innerHTML=\"感谢您的提交，我们不会记录您的邮箱的\";'></span>", true);
				teacherSay=function(){};
				shiw=function(){};
			}
			var Count1=0, Count2=0, NoResult=0;
			var YYY = "嘤嘤嘤";
			var unConnected = "还在吗|呜呜呜，不理我了|不理我了qaq|你吱一声行吗|还活i着吗".split('|');
			function shiw() {
				useTime = 0;
				var texTT = mainsay.value;
				texTT=texTT.replace('<','&lt;');
				texTT=texTT.replace('>','&gt;');
				texTT=texTT.replace('&','&amp;');
				var str="";
				var cuteAdj = "可爱的|善良的|帅气的|聪明的".split('|');
				var donnow = "我还不知道你说的是什么意思呢，你让我回去学一学吧|emmmm|emmm|让我想一下".split('|');
				document.getElementById("mainchat").innerHTML=document.getElementById("mainchat").innerHTML+"<p><span class=titlesay>您 "+getTime()+"</span><br><span class=isay>"+texTT+"</span></p>";
				mainsay.value='';
                    			var divd = document.getElementById('mainpan');
		                   	divd.scrollTop = divd.scrollHeight; 
				if ((fd(texTT, "你是谁") || fd(texTT, "你是哪")) && !fd(texTT, "奶奶") && !fd(texTT, "爷爷") && !fd(texTT, "外公") && !fd(texTT, "外婆") && !fd(texTT, "爸爸") && !fd(texTT, "妈妈") && !fd(texTT, "姐姐") && !fd(texTT, "弟弟") && !fd(texTT, "妹妹") && !fd(texTT, "哥哥") && !fd(texTT, "儿子") && !fd(texTT, "女儿") && !fd(texTT, "孙子") && !fd(texTT, "孙女") && !fd(texTT, "侄子")) {
					str="我是"+cuteAdj[Rand()%cuteAdj.length]+BotName+"。欢迎跟我聊天哦";
					teacherSay(str);
					return;
				}
				if (Rand()%10==0) {
					str="。。。";
					teacherSay(str);
					return;

				}
				if (fd(texTT, "你奶奶是谁") || fd(texTT, "你奶奶是哪") || fd(texTT, "你奶奶是什么") || fd(texTT, "你奶奶是啥")) {
					str="我奶奶当然是"+cuteAdj[Rand()%cuteAdj.length]+GMotherName;
					teacherSay(str);
					return;
				}
				if (fd(texTT, "你是吗")) {
					str="我是"+cuteAdj[Rand()%cuteAdj.length]+BotName+"。欢迎跟我聊天哦";
					teacherSay(str);
					return;
				}
				if (fd(texTT, "在吗")) {
					str="我一直都在你身边哦";
					teacherSay(str);
					return;
				}
				if (fd(texTT, "你有爱好") && (fd(texTT, "啥") || fd(texTT, "什么") || fd(texTT, "些"))) {
					str="我爱好ssh哦!";
					teacherSay(str);
					return;
				}
				if (fd(texTT, "友有朋你女吗")) {
					str="对不起，我还没有哦!";
					ableToOpen++;
					teacherSay(str);
					return;
				}
				if (fd(texTT, "你我爱吗")) {
					str="我当然爱你哦";
					ableToOpen++;
					teacherSay(str);
					return;
				}
				if (fd(texTT, "是什么意思")) {
					str="就是那个意思啦~~";
					ableToOpen++;
					teacherSay(str);
					return;
				}
				var tooMany1 = "发那么多|为什么发|你发".split("|");
				var tooMany2 = "干嘛|干什么".split("|");
				if (fd(texTT, "。。。")) {
					str=tooMany1[Rand()%tooMany1.length]+"句号"+tooMany2[Rand()%tooMany2.length];
					teacherSay(str);
					return;
				}
				if ((fd(texTT, "我叫") || fd(texTT, "我的名字")) && !fd(texTT, "什么") && !fd(texTT, "啥")) {
					str="我记住了哦，"+texTT.replace(/我/, "你");
					teacherSay(str);
					return;
				}
				if ((fd(texTT, "是谁") || fd(texTT, "是?") || fd(texTT, "是什么") || fd(texTT, "是哪")) && (fd2(texTT, "yemaster") || fd2(texTT, "Yemaster"))) {
					str="就是"+cuteAdj[Rand()%cuteAdj.length]+"我啦";
					teacherSay(str);
					return;
				}
				if (fd2(texTT, "emmm")) {
					str="。。。";
					teacherSay(str);
					return;
				}
				if (texTT.match(/^\s*$/)) {
					str=tooMany1[Rand()%tooMany1.length]+"空格"+tooMany2[Rand()%tooMany2.length];
					teacherSay(str);
					return;
				}
				if (texTT.split(':')[0]=='calc') {
					try  {
						str="运行成功！<br>结果:"+eval(texTT.split(":")[1]);
					}
					catch(exception) {	
						str="运行失败！<br>结果:"+exception;
					}
					teacherSay(str);
					return;
				}
				var lemon = "酸了酸了|wow|什么鬼东东|~~~".split('|');
				if (ableToOpen >= 5 && fd2(texTT, "ssh") || fd2(texTT, "孙舒涵")) {
					ableToOpen = 0;
					teacherSay(lemon[Rand()%lemon.length]);
					showLove();
					return;
				}
				if (texTT.match(/^[a-z,A-Z,\s]+$/)) {
					str="我不懂英文的哦";
					teacherSay(str);
					return;
				}
				if (texTT.match(/^[0-9]+$/)) {
					str=parseInt(texTT)+1;
					teacherSay(str);
					return;
				}
				str=donnow[Rand()%donnow.length];
				teacherSay(str);
			}
			function showLove() {
				if (asdbfdscisxhawdiuahwimiwm != "adnssaffww"+document.getElementById("qassa").innerHTML) return;
				app.style.opacity='0';
				setTimeout(function() { app.style.display="none"; },2000);
				document.body.style.backgroundColor="pink";
				var allHeight = document.body.clientHeight-100;
				var allWidth = document.body.clientWidth-110;
				var heartNum = Rand()%300 + 300;
				var nCount = 0,nCount2 = 0;
				document.getElementById('heartBoard').style.display='';
				for (var i = 1; i <= heartNum; ++i) {
					document.getElementById('heartBoard').innerHTML=document.getElementById('heartBoard').innerHTML+"<div id='heartBox"+i+"' style='float:left;position:absolute;top:"+Rand()%allHeight+"px;left:"+Rand()%allWidth+"px;'><div id='heart"+i+"' class='heart'></div></div>";
				}	
				setTimeout(function() { var heartSe = setInterval(function() {
					++nCount;
					if (nCount > heartNum) 
						clearInterval(heartSe);
					document.getElementById("heart"+nCount).style.opacity=nCount/heartNum;
				}, 30);}, 2000);
				setTimeout(function() { document.getElementById("gggyyy").style.top="20%";},12000);
				setTimeout(function() { document.getElementById("heartBoard").style.filter="blur(12px)";},14000);
				
			}
			function teacherSay(e,d=false) {
				if (e == '')
					e="我什么都没说";
				if (ableToOpen > cow && ableToOpen < 5) {
					cow = ableToOpen;
					teacherSay("您已经完成了"+ableToOpen+"/5，完成后即可开启彩蛋!");
				}
				else if (ableToOpen >= 5 && cow!=114514) {
					cow = 114514;
					teacherSay("开启彩蛋!请自行探索");
				}
				++Count2;
				if (Rand()%15==0)
					teacherSay(YYY);
				if (!robotNotSay) 
					if (d) 
						setTimeout(function() { document.getElementById("mainchat").innerHTML=document.getElementById("mainchat").innerHTML+"<p><span class=titlesay>"+BotName+" "+getTime()+"</span><br><span class=ysay>"+e+"</span></p>";
                    			var divd = document.getElementById('mainpan');
		                    	divd.scrollTop = divd.scrollHeight; }, 10);
					else
						setTimeout(function() { document.getElementById("mainchat").innerHTML=document.getElementById("mainchat").innerHTML+"<p><span class=titlesay>"+BotName+" "+getTime()+"</span><br><span class=ysay>"+e+"</span></p>";
                    			var divd = document.getElementById('mainpan');
		                    	divd.scrollTop = divd.scrollHeight; }, e.length*50);
			}
			function systemSay(e) {
				if (e=='')
					e="系统什么也没有提示";
				document.getElementById("mainchat").innerHTML=document.getElementById("mainchat").innerHTML+"<p class=systembox><span class=systemsay>"+e+"</span></p>";
                    			var divd = document.getElementById('mainpan');
		                   	divd.scrollTop = divd.scrollHeight;
			}
			setInterval(function(){
				useTime++;
				if (useTime>180) {
					teacherSay(unConnected[Rand()%unConnected.length]);
					useTime=0;
				}	
			},1000);
			var hiddenProperty = 'hidden' in document ? 'hidden' :    
			'webkitHidden' in document ? 'webkitHidden' :    
			'mozHidden' in document ? 'mozHidden' :    
			null;
			var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange');
			var onVisibilityChange = function(){
				if (!document[hiddenProperty]) {    
					document.title=BotName+"聊天";
				}else{
					document.title="呜呜呜不理我了";
				}
			}
			document.addEventListener(visibilityChangeEvent, onVisibilityChange);
			teacherSay("我是"+BotName+"人工制杖，欢迎跟我聊天哦", true);
		</script>
	</body>
</html>
